home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 January / PCWorld_2007-01_cd.bin / v cisle / autoit / autoit-v3.2.0.1-setup.exe / Examples / Helpfile / _GUICtrlComboSelectString.au3 < prev    next >
Text File  |  2006-06-17  |  1KB  |  35 lines

  1. #include <GuiConstants.au3>
  2. #include <GuiCombo.au3>
  3.  
  4. Opt('MustDeclareVars',1)
  5.  
  6. Dim $Label,$Input,$Btn_Search,$Combo,$Btn_Exit,$Status,$msg,$ret
  7.  
  8. GuiCreate("ComboBox Select String", 392, 254)
  9.  
  10. $Label = GuiCtrlCreateLabel("Enter Search String", 20, 20, 120, 20)
  11. $Input = GuiCtrlCreateInput("", 160, 20, 180, 20)
  12. $Btn_Search = GuiCtrlCreateButton("Search", 160, 50, 90, 30)
  13. $Combo = GuiCtrlCreateCombo("", 70, 100, 270, 100,$CBS_SIMPLE)
  14. GUICtrlSetData($Combo,"AutoIt|v3|is|freeware|BASIC-like|scripting|language")
  15. $Btn_Exit = GuiCtrlCreateButton("Exit", 150, 200, 90, 30)
  16. $Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))
  17. GuiSetState()
  18. While 1
  19.     $msg = GuiGetMsg()
  20.     Select
  21.         Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
  22.             ExitLoop
  23.         Case $msg = $Btn_Search
  24.             If(StringLen(GUICtrlRead($Input)) > 0) Then
  25.                 $ret = _GUICtrlComboSelectString($Combo,-1,GUICtrlRead($Input))
  26.                 If($ret <> $CB_ERR) Then
  27.                     GUICtrlSetData($Status,'Found "' & GUICtrlRead($Input) & '" at index: ' & $ret)
  28.                 Else
  29.                     GUICtrlSetData($Status,'"' & GUICtrlRead($Input) & '" Not Found')
  30.                 EndIf
  31.             EndIf
  32.     EndSelect
  33. WEnd
  34. Exit
  35.